# Functions -------------------------------------------------------------------------

get_plot_data <- function(pm_object, f = -5:5,
                          data, iterations = 5000, 
                          seed = 10) {
  set.seed(seed)
  pe <- PanelEstimate(pm_object, 
                      number.iterations = iterations, 
                      data = data)
  
  placebo <- placebo_test(pm_object,  
                          number.iterations = iterations,
                          data = data,
                          plot = F)
  
  
  plaecbo_cis_pre <- apply(placebo$bootstrapped.estimates, 2, quantile, probs = c(0.025, .05, .95, 0.975))
  plaecbo_cis_post <- apply(pe$bootstrapped.estimates, 2, quantile, probs = c(0.025, .05, .95, 0.975))
  
  plotData <- data.frame(t = f,
                         estimate = c(placebo$estimates, 0, pe$estimates),
                         se = c(rep(NA, 5), pe$standard.error),
                         ci.025 = c(plaecbo_cis_pre[1, ], 0 , plaecbo_cis_post[1,]),
                         ci.5 = c(plaecbo_cis_pre[2, ], 0, plaecbo_cis_post[2,]),
                         ci.95 = c(plaecbo_cis_pre[3, ], 0 , plaecbo_cis_post[3,]),
                         ci.975 = c(plaecbo_cis_pre[4, ], 0 , plaecbo_cis_post[4,]))
}